package marvin.webapp.audio.displaybeans;

import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;

import marvin.webapp.audio.subscription.ClientHandler;
import marvin.webapp.exception.MarvinException;

public class ClientDB {
	private String name = "";
	private boolean resumeVisible = false;
	private ClientHandler client;
	
	private List<File> playList;
	
	public ClientDB(ClientHandler client) {
		super();
		this.client = client;
		this.name = client.getClientName();
		playList = client.getPlayList();
	}
	
	public String getName() {
		return name;
	}

	public int getSound() {
		return client.getSound();
	}

	public void setSound(int sound) {
		client.setSound(sound);
		client.sentToClient("sound:"+sound);
	}

	public void stream(File file) throws IOException, InterruptedException, MarvinException {
		client.streamFile(file);		
	}
	
	public void stream(URI uri) throws IOException {
		client.stream(uri);		
	}

	public ClientHandler getClient() {
		return client;
	}

	public boolean isResumeVisible() {
		return resumeVisible;
	}

	public void setResumeVisible(boolean resumeVisible) {
		this.resumeVisible = resumeVisible;
	}

	public List<File> getPlayList() {
		return playList;
	}

	public void streamPlayList() throws IOException, MarvinException {
		client.streamPlayList();
	}
}
